<!--
 * createor: zc
 * email: zc8023zs@163.com
 * create_time: 2020/3/14 13:46:24
 *-->
<template>
  <el-container>
    <el-header>
      全国省市区街道详情
    </el-header>
    <el-main>
      <el-form label-width="200px" :inline="true" style="padding:5% 5% 0 5%">
        <el-form-item label="编号：">
          <span>{{formData.id}}</span>
        </el-form-item>
        <el-form-item label="编码：">
          <span>{{formData.code}}</span>
        </el-form-item>
        <el-form-item label="上级ID：">
          <span>{{formData.pid}}</span>
        </el-form-item>
        <el-form-item label="级别：">
          <span>{{formData.level}}</span>
        </el-form-item>
        <el-form-item label="名称：">
          <span>{{formData.name}}</span>
        </el-form-item>
        <el-form-item label="状态：">
          <span>{{formData.is_open}}</span>
        </el-form-item>
      </el-form>
    </el-main>
  </el-container>
</template>
<style scoped>
body .app-container .el-container,
body .app-container .el-header,
body .app-container .el-main,
body .el-container,
body .el-header,
body .el-main {
  padding: 0;
  -webkit-box-sizing: border-box;
  box-sizing: border-box;
}
</style>
<script>
import { Loading } from "element-ui";
import {
  jbr_base_areaInfo
} from '@/api/project/wmyh/project_wmyh_jbr_base_area'
export default {
  name: "a_wmyha_jbr_base_area_info",
  data() {
    return {
      infoLoading: false,
      formData:{
        id: 0, 
        code: 0, 
        pid: 0, 
        level: 0, 
        name: 0, 
        is_open: 0, 
      }
    };
  },
  activated() {
    var result = location.search.match(new RegExp("[\?\&]id=([^\&]+)", "i"));
    if(result != null || result.length > 0){
      this.onInfo(result[1]);
    }
  },
  methods: {
    onInfo(id){
      this.infoLoading=true;
      jbr_base_areaInfo({id:id}).then(r=>{
        this.formData.id = r.dataSingle.id, 
        this.formData.code = r.dataSingle.code, 
        this.formData.pid = r.dataSingle.pid, 
        this.formData.level = r.dataSingle.level, 
        this.formData.name = r.dataSingle.name, 
        this.formData.is_open = r.dataSingle.is_open, 
        this.infoLoading=false;
      }).catch(()=>{
        this.infoLoading=false;
      });
    }
  }
}
</script>
